using System;
using System.Collections.Generic;
using System.Text;

namespace NBusiness.CodeDom
{
    [Serializable]
	public abstract class EntityAccess : EntityRule
	{
		private bool _allow = true;

		public bool Allow
		{
			get { return _allow; }
			set { _allow = value; }
		}
		private string _role = null;

		public string Role
		{
			get { return _role; }
			set { _role = value; }
		}
		private EntityAccessType _type = EntityAccessType.Unknown;

		public EntityAccessType Type
		{
			get { return _type; }
			set { _type = value; }
		}
		private EntityField _field = null;

		public EntityField Field
		{
			get { return _field; }
			set { _field = value; }
		}

		public override string ToString()
		{
			return string.Format("access {0} {1} {2} {3}",
				(_allow ? "allow" : "deny"),
				_role,
				_type,
				_field);
		}
	}
}
